package com.qingke.test;

import java.math.BigDecimal;

public class Cylinder extends Circle{
	private double height=1;
	public Cylinder(double radius){
		this.setRadius(radius);
	}
	public Cylinder(double radius,double height){
		this.setRadius(radius);
		this.height=height;
	}
	public Cylinder(double radius,double height,String color){
		this.setRadius(radius);
		this.height=height;
		this.setColor(color);
	}
	public double getHeight(){
		return this.height;
	}
	public void setHeight(double height){
		this.height=height;
	}
	public double getVolume(){
		double volume=Math.PI*getRadius()*getRadius()*height;
		BigDecimal bg = new BigDecimal(volume);  
		volume= bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); 
		return volume;
	}
	public String toString(){
		String str="Cylinder[height="+height+",Circle[radius="+getRadius()+",color="+getColor()+"]]";
		return str;
	}
}
